<?php
namespace app\api\controller;
use think\Db;

class Article extends Common
{
    public function notice(){
        $this->checkSign(false);
        $list = Db::name('article')
            ->where('type_id',1)
            ->where('is_show',1)
            ->cache(true)
            ->field('title,content,id,create_time')
            ->select();
        return package(0,'success',$list);
    }
    public function getArticleInfo(){
       $data = $this->checkSign(false);
       $id = intval($data['id']??0);
       if(!$id){
           return package(2006,'id错误');
       }
       $info = Db::name('article')
           ->where('is_show',1)
           ->where('id',$id)
           ->cache(true)
           ->field('title,content')
           ->find();
       return package(0,'success',$info);
    }

}